---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/jesse/Dropbox/voter_id/Replication/table7_and_a10.log
  log type:  text
 opened on:  17 Aug 2020, 13:21:32

. 
. **** get the datasets ready to compute these values
. 
. use "$path/provisional_ballots.dta", clear

. keep if general == 0
(127,000 observations deleted)

. keep if year == 2016
(14,750 observations deleted)

. 
. rename pv_ethnicity ethnic_code

. rename pv_race race_code

. gen hispanic = ethnic_code == "HL"

. replace hispanic = . if (race_code == "U" | race_code == "") & ethnic_code != "HL"
(6,462 real changes made, 6,462 to missing)

. gen black = race_code == "B" & hispanic == 0 

. replace black = . if (race_code == "U" | race_code == "") & ethnic_code != "HL"
(6,462 real changes made, 6,462 to missing)

. gen white = race_code == "W" & hispanic == 0

. replace white = . if (race_code == "U" | race_code == "")  & ethnic_code != "HL"
(6,462 real changes made, 6,462 to missing)

. gen othernw = race_code != "U" & hispanic == 0 & black == 0 & white == 0 

. replace othernw = . if (race_code == "U" | race_code == "")  & ethnic_code != "HL"
(6,462 real changes made, 6,462 to missing)

. drop race_code ethnic_code

. 
. rename pv_party party_cd

. gen dem = party_cd == "DEM"

. gen rep = party_cd == "REP"

. gen una = dem == 0 & rep == 0 

. drop party_cd 

. 
. keep if reason == "ID NOT PROVIDED"
(14,981 observations deleted)

. compress
  variable general was float now byte
  variable year was float now int
  variable hispanic was float now byte
  variable black was float now byte
  variable white was float now byte
  variable othernw was float now byte
  variable dem was float now byte
  variable rep was float now byte
  variable una was float now byte
  variable reason was str44 now str15
  (64,295 bytes saved)

. 
. tempfile provisional

. save `provisional'
file /var/folders/8m/689p34g55236b5p1vh56w2780000gn/T//S_59563.000001 saved

. 
. use id dem rep hispanic black white othernw ///
>         birth_year voted no_dmv_match new_reg election using "$path/nc_dataset.dta" if (election == 9 | election == 10) & new_reg == 0, clear

.         
. egen non_miss = rownonmiss(hispanic black white othernw birth_year voted)

. gen in_sample = non_miss == 6

. drop non_miss

. keep if in_sample
(293,792 observations deleted)

.         
. gen una = dem == 0 & rep == 0

. compress
  variable in_sample was float now byte
  variable una was float now byte
  (77,765,076 bytes saved)

. 
. tempfile voterfile

. save `voterfile'
file /var/folders/8m/689p34g55236b5p1vh56w2780000gn/T//S_59563.000002 saved

. 
. **** 
. * OVERALL EFFECT IN 2016 PRIMARY
. ****
. 
. // EFFECT = MECHANICAL + DETERRENT
. 
.         // MECHANICAL = MECHANICAL
.         use `provisional', clear

.         local mech = _N

.         
.         // DETERRENT = DETERRENT | NOID * TOTAL NOID
.         use `voterfile', clear

.         keep if election == 9 
(6,480,423 observations deleted)

.         qui sum no_dmv_match 

.         local total_noid = r(sum)

.         di `total_noid'
196544

.         local det = 0.007 * `total_noid'

.         di `mech'
1169

.         di `det'
1375.808

.         di round(`mech' + `det', 1)
2545

. 
. 
. **** 
. * OVERALL EFFECT IN 2016 GENERAL
. ****
. 
. // EFFECT = DETERRENT
. 
.         // DETERRENT = DETERRENT | NOID * TOTAL NOID
.         use `voterfile', clear

.         keep if election == 10
(6,480,423 observations deleted)

.         qui sum no_dmv_match 

.         local total_noid = r(sum)

.         di `total_noid'
196544

.         local det = 0.026 * `total_noid'

.         di round(`det', 1)
5110

.         
. 
. 
. ****
. * EFFECT DECOMPOSED BY RACE IN 2016 PRIMARY
. ****
. 
. // EFFECT = MECHANICAL + DETERRENT
. 
.         // MECHANICAL = MECHANICAL | NOID, WHITE +
.                                 use `provisional', clear

.                                 qui sum white

.                                 local mech_white = r(mean) * _N

.                                 di `mech_white'
648.68575

.                                 //      MECHANICAL | NOID, BLACK +
.                                 qui sum black

.                                 local mech_black = r(mean) * _N

.                                 di `mech_black'
420.6215

.                                 //      MECHANICAL | NOID, HISPANIC  +
.                                 qui sum hispanic

.                                 local mech_hispanic = r(mean) * _N

.                                 di `mech_hispanic'
21.850467

.                                 //  MECHANICAL | NOID, OTHERNW 
.                                 qui sum othernw

.                                 local mech_othernw = r(mean) * _N

.                                 di `mech_othernw'
77.84229

.                                 
.         // DETERRENT = DETERRENT | NOID, WHITE * TOTAL NOID, WHITE +
.                                 use `voterfile', clear

.                                 keep if election == 9 
(6,480,423 observations deleted)

.                                 qui sum white if no_dmv_match

.                                 local pct_white = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_white = `pct_white' * `total_noid'

.                                 di `total_noid_white'
99126

.                                 local det_white = 0.007 * `total_noid_white'

.                                 di `det_white'
693.882

.                                 // DETERRENT | NOID, BLACK * TOTAL NOID, BLACK +
.                                 qui sum black if no_dmv_match

.                                 local pct_black = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_black = `pct_black' * `total_noid'

.                                 di `total_noid_black'
76640

.                                 local det_black = 0.007 * `total_noid_black'

.                                 di `det_black'
536.48

.                                 // DETERRENT | NOID, HISPANIC * TOTAL NOID, HISPANIC +
.                                 qui sum hispanic if no_dmv_match

.                                 local pct_hispanic = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_hispanic = `pct_hispanic' * `total_noid'

.                                 di `total_noid_hispanic'
9264

.                                 local det_hispanic = 0.007 * `total_noid_hispanic'

.                                 di `det_hispanic'
64.848

.                                 // DETERRENT | NOID, OTHERNW * TOTAL NOID, OTHERNW
.                                 qui sum othernw if no_dmv_match

.                                 local pct_othernw = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_othernw = `pct_othernw' * `total_noid'

.                                 di `total_noid_othernw'
11514

.                                 local det_othernw = 0.007 * `total_noid_othernw'

.                                 di `det_othernw'
80.598

.                                 
.         // EFFECT | WHITE = MECHANICAL | WHITE + DETERRENT | WHITE
.         local effect_white = `mech_white' + `det_white'

.         di round(`effect_white',1)
1343

.         // EFFECT | BLACK = MECHANICAL | BLACK + DETERRENT | BLACK
.         local effect_black = `mech_black' + `det_black'

.         di round(`effect_black',1)
957

.         // EFFECT | HISPANIC = MECHANICAL | HISPANIC + DETERRENT | HISPANIC
.         local effect_hispanic = `mech_hispanic' + `det_hispanic'

.         di round(`effect_hispanic',1)
87

.         // EFFECT | OTHERNW = MECHANICAL | OTHERNW + DETERRENT | OTHERNW
.         local effect_othernw = `mech_othernw' + `det_othernw'

.         di round(`effect_othernw',1)
158

. 
.         // TOTAL EFFECT
.         local total_effect = `effect_white' + `effect_black' + `effect_hispanic' + `effect_othernw'

.         di round(`total_effect',1)
2545

.         
.         // COMPOSITION OF ELECTORATE
.         drop if white == .
(0 observations deleted)

.         
.                 // SHARE WHITE
.                 qui sum white if voted

.                 local white_share_law = r(mean)

.                 di `white_share_law'
.77344766

.                 
.                 // SHARE BLACK
.                 qui sum black if voted

.                 local black_share_law = r(mean)

.                 di `black_share_law'
.19317772

.                 
.                 // SHARE HISPANIC
.                 qui sum hispanic if voted

.                 local hispanic_share_law = r(mean)

.                 di `hispanic_share_law'
.01071601

.                 
.                 // SHARE OTHER NW
.                 qui sum othernw if voted

.                 local othernw_share_law = r(mean)

.                 di `othernw_share_law'
.02265861

.                 
.                 // ADD VOTE OVERALL EFFECT BY RACE BACK INTO THE ELECTORATE
.                 keep if voted
(4,318,331 observations deleted)

.                 qui count

.                 local plus = r(N) + round(`effect_white',1)

.                 set obs `plus'
number of observations (_N) was 2,162,092, now 2,163,435

.                 replace white = 1 if white == . 
(1,343 real changes made)

.                 replace black = 0 if black == .
(1,343 real changes made)

.                 replace hispanic = 0 if hispanic == .
(1,343 real changes made)

.                 replace othernw = 0 if othernw == .
(1,343 real changes made)

.                 replace voted = 1 if voted == .
(1,343 real changes made)

.                 
.                 qui count

.                 local plus = r(N) + round(`effect_black',1)

.                 set obs `plus'
number of observations (_N) was 2,163,435, now 2,164,392

.                 replace white = 0 if white == . 
(957 real changes made)

.                 replace black = 1 if black == .
(957 real changes made)

.                 replace hispanic = 0 if hispanic == .
(957 real changes made)

.                 replace othernw = 0 if othernw == .
(957 real changes made)

.                 replace voted = 1 if voted == .
(957 real changes made)

.                 
.                 qui count

.                 local plus = r(N) + round(`effect_hispanic',1)

.                 set obs `plus'
number of observations (_N) was 2,164,392, now 2,164,479

.                 replace white = 0 if white == . 
(87 real changes made)

.                 replace black = 0 if black == .
(87 real changes made)

.                 replace hispanic = 1 if hispanic == .
(87 real changes made)

.                 replace othernw = 0 if othernw == .
(87 real changes made)

.                 replace voted = 1 if voted == .
(87 real changes made)

.                 
.                 qui count

.                 local plus = r(N) + round(`effect_othernw',1)

.                 set obs `plus'
number of observations (_N) was 2,164,479, now 2,164,637

.                 replace white = 0 if white == . 
(158 real changes made)

.                 replace black = 0 if black == .
(158 real changes made)

.                 replace hispanic = 0 if hispanic == .
(158 real changes made)

.                 replace othernw = 1 if othernw == .
(158 real changes made)

.                 replace voted = 1 if voted == .
(158 real changes made)

.                 
.                 // SHARE WHITE
.                 qui sum white if voted

.                 local white_share_no_law = r(mean)

.                 di `white_share_no_law'
.77315873

.                 
.                 // SHARE BLACK
.                 qui sum black if voted

.                 local black_share_no_law = r(mean)

.                 di `black_share_no_law'
.1933927

.                 
.                 // SHARE HISPANIC
.                 qui sum hispanic if voted

.                 local hispanic_share_no_law = r(mean)

.                 di `hispanic_share_no_law'
.0107436

.                 
.                 // SHARE OTHER NW
.                 qui sum othernw if voted

.                 local othernw_share_no_law = r(mean)

.                 di `othernw_share_no_law'
.02270496

.         
. 
. ****
. * EFFECT DECOMPOSED BY RACE IN 2016 GENERAL
. ****
. 
. // EFFECT =  DETERRENT
. 
.         // DETERRENT = DETERRENT | NOID, WHITE * TOTAL NOID, WHITE +
.                                 use `voterfile', clear

.                                 keep if election == 10 
(6,480,423 observations deleted)

.                                 qui sum white if no_dmv_match

.                                 local pct_white = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_white = `pct_white' * `total_noid'

.                                 di `total_noid_white'
99126

.                                 local det_white = 0.026 * `total_noid_white'

.                                 di `det_white'
2577.276

.                                 // DETERRENT | NOID, BLACK * TOTAL NOID, BLACK +
.                                 qui sum black if no_dmv_match

.                                 local pct_black = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_black = `pct_black' * `total_noid'

.                                 di `total_noid_black'
76640

.                                 local det_black = 0.026 * `total_noid_black'

.                                 di `det_black'
1992.64

.                                 // DETERRENT | NOID, HISPANIC * TOTAL NOID, HISPANIC +
.                                 qui sum hispanic if no_dmv_match

.                                 local pct_hispanic = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_hispanic = `pct_hispanic' * `total_noid'

.                                 di `total_noid_hispanic'
9264

.                                 local det_hispanic = 0.026 * `total_noid_hispanic'

.                                 di `det_hispanic'
240.864

.                                 // DETERRENT | NOID, OTHERNW * TOTAL NOID, OTHERNW
.                                 qui sum othernw if no_dmv_match

.                                 local pct_othernw = r(mean)

.                                 qui sum no_dmv_match

.                                 local total_noid = r(sum)

.                                 local total_noid_othernw = `pct_othernw' * `total_noid'

.                                 di `total_noid_othernw'
11514

.                                 local det_othernw = 0.026 * `total_noid_othernw'

.                                 di `det_othernw'
299.364

. 
.                                 // TOTAL EFFECT
.                                 local total_effect = `det_white' + `det_black' + `det_hispanic' + `det_othernw'

.                                 di round(`total_effect',1)
5110

.                                 
.                 // COMPOSITION OF ELECTORATE
.                 drop if white == .
(0 observations deleted)

. 
.         
.                         // SHARE WHITE
.                         qui sum white if voted

.                         local white_share_law = r(mean)

.                         di `white_share_law'
.74114274

.                         
.                         // SHARE BLACK
.                         qui sum black if voted

.                         local black_share_law = r(mean)

.                         di `black_share_law'
.21542284

.                         
.                         // SHARE HISPANIC
.                         qui sum hispanic if voted

.                         local hispanic_share_law = r(mean)

.                         di `hispanic_share_law'
.01485947

.                         
.                         // SHARE OTHER NW
.                         qui sum othernw if voted

.                         local othernw_share_law = r(mean)

.                         di `othernw_share_law'
.02857496

. 
.                         // ADD VOTE OVERALL EFFECT BY RACE BACK INTO THE ELECTORATE
.                         keep if voted
(2,383,304 observations deleted)

.                         qui count

.                         local plus = r(N) + round(`det_white',1)

.                         set obs `plus'
number of observations (_N) was 4,097,119, now 4,099,696

.                         replace white = 1 if white == . 
(2,577 real changes made)

.                         replace black = 0 if black == .
(2,577 real changes made)

.                         replace hispanic = 0 if hispanic == .
(2,577 real changes made)

.                         replace othernw = 0 if othernw == .
(2,577 real changes made)

.                         replace voted = 1 if voted == .
(2,577 real changes made)

.                         
.                         qui count

.                         local plus = r(N) + round(`det_black',1)

.                         set obs `plus'
number of observations (_N) was 4,099,696, now 4,101,689

.                         replace white = 0 if white == . 
(1,993 real changes made)

.                         replace black = 1 if black == .
(1,993 real changes made)

.                         replace hispanic = 0 if hispanic == .
(1,993 real changes made)

.                         replace othernw = 0 if othernw == .
(1,993 real changes made)

.                         replace voted = 1 if voted == .
(1,993 real changes made)

.                         
.                         qui count

.                         local plus = r(N) + round(`det_hispanic',1)

.                         set obs `plus'
number of observations (_N) was 4,101,689, now 4,101,930

.                         replace white = 0 if white == . 
(241 real changes made)

.                         replace black = 0 if black == .
(241 real changes made)

.                         replace hispanic = 1 if hispanic == .
(241 real changes made)

.                         replace othernw = 0 if othernw == .
(241 real changes made)

.                         replace voted = 1 if voted == .
(241 real changes made)

.                         
.                         qui count

.                         local plus = r(N) + round(`det_othernw',1)

.                         set obs `plus'
number of observations (_N) was 4,101,930, now 4,102,229

.                         replace white = 0 if white == . 
(299 real changes made)

.                         replace black = 0 if black == .
(299 real changes made)

.                         replace hispanic = 0 if hispanic == .
(299 real changes made)

.                         replace othernw = 1 if othernw == .
(299 real changes made)

.                         replace voted = 1 if voted == .
(299 real changes made)

.                         
.                         // SHARE WHITE
.                         qui sum white if voted

.                         local white_share_no_law = r(mean)

.                         di `white_share_no_law'
.74084772

.                         
.                         // SHARE BLACK
.                         qui sum black if voted

.                         local black_share_no_law = r(mean)

.                         di `black_share_no_law'
.21564033

.                         
.                         // SHARE HISPANIC
.                         qui sum hispanic if voted

.                         local hispanic_share_no_law = r(mean)

.                         di `hispanic_share_no_law'
.0148997

.                         
.                         // SHARE OTHER NW
.                         qui sum othernw if voted

.                         local othernw_share_no_law = r(mean)

.                         di `othernw_share_no_law'
.02861225

.         
. 
. ****
. * EFFECT DECOMPOSED BY PARTY IN 2016 PRIMARY
. ****
. 
. // EFFECT = MECHANICAL + DETERRENT
.         // MECHANICAL = MECHANICAL | NOID, DEM +
.                                 use `provisional', clear

.                                 qui sum dem

.                                 local mech_dem = r(mean) * _N

.                                 di `mech_dem'
670

.                                 //      MECHANICAL | NOID, REP +
.                                 qui sum rep

.                                 local mech_rep = r(mean) * _N

.                                 di `mech_rep'
265

.                                 //      MECHANICAL | NOID, UNA
.                                 qui sum una

.                                 local mech_una = r(mean) * _N

.                                 di `mech_una'
234

. 
. 
.         // DETERRENT = DETERRENT | NOID, DEM * TOTAL NOID, DEM +
.                                 use `voterfile', clear

.                                 keep if election == 9 
(6,480,423 observations deleted)

.                                 qui sum no_dmv_match if dem

.                                 local total_noid_dem = r(sum)

.                                 di `total_noid_dem'
112940

.                                 local det_dem = 0.007 * `total_noid_dem'

.                                 di `det_dem'
790.58

.                                 // DETERRENT | NOID, rep * TOTAL NOID, rep +
.                                 qui sum no_dmv_match if rep

.                                 local total_noid_rep = r(sum)

.                                 di `total_noid_rep'
37752

.                                 local det_rep = 0.007 * `total_noid_rep'

.                                 di `det_rep'
264.264

.                                 // DETERRENT | NOID, una * TOTAL NOID, una +
.                                 qui sum no_dmv_match if una

.                                 local total_noid_una = r(sum)

.                                 di `total_noid_una'
45852

.                                 local det_una = 0.007 * `total_noid_una'

.                                 di `det_una'
320.964

.         
. 
.         // EFFECT | dem = MECHANICAL | dem + DETERRENT | dem
.         local effect_dem = `mech_dem' + `det_dem'

.         di round(`effect_dem',1)
1461

.         // EFFECT | rep = MECHANICAL | rep + DETERRENT | rep
.         local effect_rep = `mech_rep' + `det_rep'

.         di round(`effect_rep',1)
529

.         // EFFECT | una = MECHANICAL | una + DETERRENT | una
.         local effect_una = `mech_una' + `det_una'

.         di round(`effect_una',1)
555

. 
.         // TOTAL EFFECT
.         local total_effect = `effect_dem' + `effect_rep' + `effect_una'

.         di round(`total_effect',1)                      
2545

. 
.         // COMPOSITION OF ELECTORATE
.         drop if dem == .
(0 observations deleted)

.         
.                 // SHARE DEM
.                 qui sum dem if voted

.                 local dem_share_law = r(mean)

.                 di `dem_share_law'
.41436396

.                 
.                 // SHARE REP
.                 qui sum rep if voted

.                 local rep_share_law = r(mean)

.                 di `rep_share_law'
.36518474

.                 
.                 // SHARE UNAFFIL
.                 qui sum una if voted

.                 local una_share_law = r(mean)

.                 di `una_share_law'
.2204513

.                 
.                 
.                 // ADD VOTE OVERALL EFFECT BY RACE BACK INTO THE ELECTORATE
.                 keep if voted
(4,318,331 observations deleted)

.                 qui count

.                 local plus = r(N) + round(`effect_dem',1)

.                 set obs `plus'
number of observations (_N) was 2,162,092, now 2,163,553

.                 replace dem = 1 if dem == . 
(1,461 real changes made)

.                 replace rep = 0 if rep == .
(1,461 real changes made)

.                 replace una = 0 if una == .
(1,461 real changes made)

.                 replace voted = 1 if voted == .
(1,461 real changes made)

.                 
.                 qui count

.                 local plus = r(N) + round(`effect_rep',1)

.                 set obs `plus'
number of observations (_N) was 2,163,553, now 2,164,082

.                 replace dem = 0 if dem == . 
(529 real changes made)

.                 replace rep = 1 if rep == .
(529 real changes made)

.                 replace una = 0 if una == .
(529 real changes made)

.                 replace voted = 1 if voted == .
(529 real changes made)

.                 
.                 qui count

.                 local plus = r(N) + round(`effect_una',1)

.                 set obs `plus'
number of observations (_N) was 2,164,082, now 2,164,637

.                 replace dem = 0 if dem == . 
(555 real changes made)

.                 replace rep = 0 if rep == .
(555 real changes made)

.                 replace una = 1 if una == .
(555 real changes made)

.                 replace voted = 1 if voted == .
(555 real changes made)

.         
.                 
.                 // SHARE dem
.                 qui sum dem if voted

.                 local dem_share_no_law = r(mean)

.                 di `dem_share_no_law'
.41455172

.                 
.                 // SHARE rep
.                 qui sum rep if voted

.                 local rep_share_no_law = r(mean)

.                 di `rep_share_no_law'
.36499977

.                 
.                 // SHARE una
.                 qui sum una if voted

.                 local una_share_no_law = r(mean)

.                 di `una_share_no_law'
.22044851

.                 
. 
. ****
. * EFFECT DECOMPOSED BY PARTY IN 2016 GENERAL
. ****
. 
. // EFFECT =  DETERRENT
. 
.         // DETERRENT = DETERRENT | NOID, dem * TOTAL NOID, dem +
.                                 use `voterfile', clear

.                                 keep if election == 10 
(6,480,423 observations deleted)

.                                 qui sum no_dmv_match if dem

.                                 local total_noid_dem = r(sum)

.                                 di `total_noid_dem'
112940

.                                 local det_dem = 0.026 * `total_noid_dem'

.                                 di `det_dem'
2936.44

.                                 // DETERRENT | NOID, rep * TOTAL NOID, rep +
.                                 qui sum no_dmv_match if rep

.                                 local total_noid_rep = r(sum)

.                                 di `total_noid_rep'
37752

.                                 local det_rep = 0.026 * `total_noid_rep'

.                                 di `det_rep'
981.552

.                                 // DETERRENT | NOID, una * TOTAL NOID, una +
.                                 qui sum no_dmv_match if una

.                                 local total_noid_una = r(sum)

.                                 di `total_noid_una'
45852

.                                 local det_una = 0.026 * `total_noid_una'

.                                 di `det_una'
1192.152

. 
.                                 // TOTAL EFFECT
.                                 local total_effect = `det_dem' + `det_rep' + `det_una'

.                                 di round(`total_effect',1)
5110

. 
.                         // COMPOSITION OF ELECTORATE
.                         drop if dem == .
(0 observations deleted)

.         
.                                 // SHARE DEM
.                                 qui sum dem if voted

.                                 local dem_share_law = r(mean)

.                                 di `dem_share_law'
.41780602

.                                 
.                                 // SHARE REP
.                                 qui sum rep if voted

.                                 local rep_share_law = r(mean)

.                                 di `rep_share_law'
.33653013

.                                 
.                                 // SHARE UNAFFIL
.                                 qui sum una if voted

.                                 local una_share_law = r(mean)

.                                 di `una_share_law'
.24566384

.                                 
.                                 
.                                 // ADD VOTE OVERALL EFFECT BY RACE BACK INTO THE ELECTORATE
.                                 keep if voted
(2,383,304 observations deleted)

.                                 qui count

.                                 local plus = r(N) + round(`det_dem',1)

.                                 set obs `plus'
number of observations (_N) was 4,097,119, now 4,100,055

.                                 replace dem = 1 if dem == . 
(2,936 real changes made)

.                                 replace rep = 0 if rep == .
(2,936 real changes made)

.                                 replace una = 0 if una == .
(2,936 real changes made)

.                                 replace voted = 1 if voted == .
(2,936 real changes made)

.                                 
.                                 qui count

.                                 local plus = r(N) + round(`det_rep',1)

.                                 set obs `plus'
number of observations (_N) was 4,100,055, now 4,101,037

.                                 replace dem = 0 if dem == . 
(982 real changes made)

.                                 replace rep = 1 if rep == .
(982 real changes made)

.                                 replace una = 0 if una == .
(982 real changes made)

.                                 replace voted = 1 if voted == .
(982 real changes made)

.                                 
.                                 qui count

.                                 local plus = r(N) + round(`det_una',1)

.                                 set obs `plus'
number of observations (_N) was 4,101,037, now 4,102,229

.                                 replace dem = 0 if dem == . 
(1,192 real changes made)

.                                 replace rep = 0 if rep == .
(1,192 real changes made)

.                                 replace una = 1 if una == .
(1,192 real changes made)

.                                 replace voted = 1 if voted == .
(1,192 real changes made)

.                         
.                                 
.                                 // SHARE dem
.                                 qui sum dem if voted

.                                 local dem_share_no_law = r(mean)

.                                 di `dem_share_no_law'
.41800129

.                                 
.                                 // SHARE rep
.                                 qui sum rep if voted

.                                 local rep_share_no_law = r(mean)

.                                 di `rep_share_no_law'
.33635031

.                                 
.                                 // SHARE una
.                                 qui sum una if voted

.                                 local una_share_no_law = r(mean)

.                                 di `una_share_no_law'
.2456484

. 
. log close
      name:  <unnamed>
       log:  /Users/jesse/Dropbox/voter_id/Replication/table7_and_a10.log
  log type:  text
 closed on:  17 Aug 2020, 13:22:13
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
